<?php

class ArticleController extends Controller {

    public function infoAction() {
        
        $articleId = Request::getParams('articleId');
        if(!$articleId||!$articleInfo = self::model('article')->findById($articleId)) {
            Response::ajax(NORMAL_ERROR, '信息查看失败');
        }
        Response::ajax(200, 'success', $articleInfo);
    }
    
    public function listAction() {
        
        $page = intval(Request::getParams('page', 1));
        $pageSize = intval(Request::getParams('pageSize', 15));
        $order = 'sort asc, article_id desc';
        $where = $value = [];
        $where[] = 'status=?';
        $value[] = 1;
        Response::ajax(200, 'success', self::model('article')->getList($where, $value, $order, $page, $pageSize));
    }

}
